#include <stdio.h>
#include <stdlib.h>

static void test1(void)
{
	int i = 1;
	int *p = &i;
// 	int *p;
// 	p=&i;

	printf("%d\n",sizeof(i));	
	printf("%d\n",sizeof(p));


	printf("i = %d\n",i);	
	printf("&i = %p\n",&i);
	printf("p = %p\n",p);
	printf("&p = %p\n",&p);
	printf("*p = %d\n",*p);

	float *a;
	double *b;
	char *c;
/*
 *指针的大小固定 不同机器不同编译器 大小不同
 * */
	printf("%d\n",sizeof(a));
	printf("%d\n",sizeof(b));
	printf("%d\n",sizeof(c));


}


static void test1_1(void)
{

	int i = 1;
	int *p= &i;
	int **q = &p;

	printf("q = %p\n",q);
	printf("*q = %p\n",*q);
	printf("**q = %d\n",**q);

}




static void test2(void)
{
	//初始为空指针 NULL宏  杜绝野指针
	int *p = NULL;

	printf("%d\n",*p);

}

static void test2_1(void)
{
	//野指针:指针没有明确指向 
	int *p;
	
	printf("%p---->%d\n",&p,*p);

}



int main(void)
{

//	test1();
	test1_1();
//	test2_1();
//	test2();
	exit(0);
}
